<?php

use App\Http\Controllers\HomeController;
use App\Http\Controllers\WeChatController;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Route;

/*
|--------------------------------------------------------------------------
| API Routes
|--------------------------------------------------------------------------
|
| Here is where you can register API routes for your application. These
| routes are loaded by the RouteServiceProvider within a group which
| is assigned the "api" middleware group. Enjoy building your API!
|
*/

Route::group([
    'middleware' => ['auth:sanctum']
], function () {
    Route::get('/wechat/user', [WeChatController::class, 'indexUser']);
    Route::post('/wechat/user/info', [WeChatController::class, 'updateUserInfo']);

    Route::group([
        'prefix' => 'reservation'
    ], function () {
        Route::post('store', [\App\Http\Controllers\ReservationLogController::class, 'store']);
        Route::get('my_list', [\App\Http\Controllers\ReservationLogController::class, 'myReservation']);
    });


});

Route::get('/reservation/timeline', [\App\Http\Controllers\ReservationLogController::class, 'getTimelineEvents']);
Route::group([
    'prefix' => 'home'
], function () {
    Route::get("setting", [HomeController::class, "siteSettingData"]);
});

Route::group([
    'prefix' => 'department'
], function () {
    Route::get('list', [\App\Http\Controllers\DepartmentCategoryController::class, 'getActiveDepartment']);
    Route::get('project/{id}', [\App\Http\Controllers\DepartmentCategoryController::class, 'getProjectOfDepartment']);
});


Route::group([
    'prefix' => 'project'
], function () {
    Route::get('detail', [\App\Http\Controllers\ProjectController::class, 'getDetail']);
    Route::get('reservation_detail', [\App\Http\Controllers\ProjectController::class, 'getReservationDetail']);
});


Route::post('/wechat/upload_file', [WeChatController::class, 'uploadFile']);
Route::any('/wechat/login', [WeChatController::class, 'login']);
Route::any('/wechat/phone', [WeChatController::class, 'decryptedPhone']);
